$(function(){
	//日历加载
	if($('.date-box').length>0){
		$('.date-box').datepicker({
			altFormat: "DD, d MM, yy"  
		});

	}
	//日历显示隐藏
	$('.date-one').on('click',function(){
		if($('.date-box').is(':visible')){
			$('.date-box').fadeOut();
		}else{
			$('.date-box').fadeIn();
		}
	});
	//日历显示隐藏
	$('.date-two').on('click',function(){
		if($('.date-box').is(':visible')){
			$('.date-box').fadeOut();
		}else{
			$('.date-box').fadeIn();
		}
	});
	//标题内容显示隐藏
	$('.title-arrow').on('click',function(){
		var $e = $(this);
		var _titlelist = $e.parents('.page-title').siblings('.title-list');
		if($(_titlelist).is(':visible')){
			$(_titlelist).slideUp();
			$e.removeClass('active');
		}else{
			//$('.title-list').slideUp();
			//$('.title-arrow').removeClass('active');
			$e.addClass('active');
			$(_titlelist).slideDown();
		}
	});
	//推荐位轮播
	
	//大家都在看
	$('.search-title-list li').hover(function(){
		$('.search-title-list li').removeClass('active');
		$(this).addClass('active');
	},function(){

	});
	$('.nav li').each(function(i){
		// $(this).css('z-index',6-i);
	});

	$('.cover-tag').on('click',function(){
		if($('.cover-erweima').is(':visible')){
			$('.cover-erweima').fadeOut();
		}else{
			$('.cover-erweima').fadeIn();
		}
		
	});

	//绘制文章热区
	//版图区域
	$(".selectBox").mouseover(function(e){
		  $(this).css({'opacity':0.3});	
		  $(".newsTitList li a[alt="+$(this).attr("alt")+"]").css('color', '#f00');
	});
	$(".selectBox").mouseout(function(e){
		  $(this).css({'border':'0','opacity':'0'});
		  $(".newsTitList li a[alt="+$(this).attr("alt")+"]").css('color', '#000');
	});

	$('#keyWord').bind('keypress',function(event){
		if(event.keyCode == "13")    
		{
			$('#search').submit();
		}
	});
	
});

//点击文章跳转
function gourl(url,tp)
{
	if(tp=="error")
	{
		alert("功能开发中...,尽请期待！");
	}else{
		window.open(url,tp);
	}

}

function showdate(mydate){
	str = mydate.split('-'); 
	var day = new Date(); 
	day.setUTCFullYear(str[0], str[1] - 1, str[2]); 
	day.setUTCHours(0, 0, 0, 0); 
	 
	if(mydate=="")	day = new Date();
	var today = new Array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');  
	var week = today[day.getDay()];
	month = day.getMonth()+1;
	date=day.getDate();
	if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)  && (navigator.userAgent.indexOf('MSIE 9.0') < 0))
		var formatdate=(day.getYear())+"年"+(month<10?'0'+month:month)+"月"+(date<10?'0'+date:date)+"日 ";
	else
		var formatdate=(day.getYear()+1900)+"年"+(month<10?'0'+month:month)+"月"+(date<10?'0'+date:date)+"日 ";
	$('#week').html(week+'<span class="calendar-ico"></span>');
	$('.date-two').html(formatdate);
}

function showdetaildate(mydate){
	str = mydate.split('-'); 
	var day = new Date(); 
	day.setUTCFullYear(str[0], str[1] - 1, str[2]); 
	day.setUTCHours(0, 0, 0, 0); 
	var today = new Array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');  
	var week = today[day.getDay()];
	month = day.getMonth()+1;
	date=day.getDate();
	if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0) && (navigator.userAgent.indexOf('MSIE 9.0') < 0))
		var formatdate=(day.getYear())+"年"+(month<10?'0'+month:month)+"月"+(date<10?'0'+date:date)+"日 ";
	else
		var formatdate=(day.getYear()+1900)+"年"+(month<10?'0'+month:month)+"月"+(date<10?'0'+date:date)+"日 ";
	$('.detail-info-date').html(week+'  '+formatdate);
	
}


